exports = {
  data: {
    title: '用户管理',
    headTip: '点击带 .列单元格编辑',
  },
  use:['rb','form','table2','jquery','datetimepicker','picView'],
  init: function(rb,form,table,$) {
    rb.path       = 'user';
    rb.controller = 'api_user';
    // 模板解析前的运行代码
    rb.log('index init');
    if( this.data.headTip ) {
      this.data.headTip = rb.getHtmlHeadTip( this.data.headTip );
    }
    rb.getJSONSync(layui.cache.apiPath + 'api_role/ajax',null,function(data) {
        rb.d.roles = rb.getSortList(data);
    })
  },
  after: function(rb,form,table) {
    // 页面渲染完后执行的代码
    // form init
    rb.initDateTimePicker('#jsf-start,#jsf-end');
    form.render('select');
    //
    rb.setWhere = function() {
      rb.where.kword = $('#jsf-kword').val() || '';
      rb.where.role  = $('#jsf-role').val() || '';
    };
    // table init
    rb.where = {
      field: 'id'
      ,order: 'desc'
    };
    // table render
    rb.table = table.render($.extend(rb.table_config,{
      url: layui.cache.apiPath + rb.controller + '/index'
      ,where: rb.where
      ,initSort: {
        field: 'id',type: 'desc'
      }
      ,cols:  [[
        {checkbox: true} // ,LAY_CHECKED: true
        ,{field: 'id',align: 'left',title: 'ID', minWidth: 60
          ,sort:true,hideDisable:true }
        ,{field: 'nick', title: L('user nick'),templet:'#nameTpl'}
        ,{field: 'email', title: L('email d'),edit: 'text',templet:'#emailTpl' }
        ,{field: 'phone', title: L('phone d'),width:125,edit: 'text',templet:'#phoneTpl'}
        ,{field: 'role_id', title: L('role'),templet:'#roleTpl'}
        // ,{field: 'rate',align:'right',width:60, title: '分佣',templet:'#rateTpl'}
        ,{field: 'status', title: L('status'), width: 60,templet:'#statusTpl',hide:true}
        ,{field: 'reg_time', title: L('reg time'),width: 125,templet:'#timeTpl',align:'right',sort:true,hide:true }
        ,{align:'left',align: 'right',minWidth:145,title: L('op'),toolbar: '#barDemo'}
      ]]
    }));

    <!--# include virtual="/lib/table-extra.js" -->
  }
}